package com.ftg.learn.day10.factory.homework;

/**
 * 测试
 *
 * @author kangjx
 * @version 1.0
 * @date 2023/8/14 上午10:36
 */
public class Player {

    public static void main(String[] args) {
        BeanInfo b1 = new BeanInfo();
        b1.setName("fly");
        b1.setClassPath("com.ftg.learn.day10.factory.homework.Fly");
        b1.setObjClass(Fly.class);

        BeanInfo b2 = new BeanInfo();
        b2.setName("lion");
        b2.setClassPath("com.ftg.learn.day10.factory.homework.Lion");
        b2.setObjClass(Lion.class);

        BeanInfo b3 = new BeanInfo();
        b3.setName("pea");
        b3.setClassPath("com.ftg.learn.day10.factory.homework.Pea");
        b3.setObjClass(Pea.class);

        BeanFactory kjx = new BeanFactory();
        kjx.createClassInstance(b1, b2, b3);

        Fly fly1 = (Fly) kjx.getObject("fly");
        fly1.setName("john");

        Lion lion = (Lion) kjx.getObject("lion");

        System.out.println(fly1.getName());

        Fly fly2 = kjx.getObject(Fly.class, "fly");
        fly2.setName("tttt");
        System.out.println(fly2.getName());


        BeanFactory zn = new BeanFactory();
        zn.createClass(b1, b2, b3);

        Fly object = zn.getObject(Fly.class);
        object.setName("小蝇");

        System.out.println(object);

        System.out.println("--->");
        BeanFactory zn1 = new BeanFactory(Fly.class, Lion.class);

        Fly object1 = zn1.getObject(Fly.class);


    }

}
